package com.esri.core.geometry;

import com.github.mikephil.charting.utils.Utils;
import java.io.ObjectStreamException;
import java.io.Serializable;

/* loaded from: classes.dex */
public abstract class Geometry implements Serializable {
    private static final long serialVersionUID = 2;
    protected VertexDescription m_description = null;
    protected volatile int m_touchFlag = 0;

    /* loaded from: classes.dex */
    private interface GTMask {
        public static final int AREA = 2048;
        public static final int LINEAR = 1024;
        public static final int MULTI_LINEAR = 16384;
        public static final int MULTI_VERTEX = 8192;
        public static final int SEGMENT = 4096;
        public static final int VERTEX = 512;
    }

    /* loaded from: classes.dex */
    enum GeometryAccelerationDegree {
        enumMild,
        enumMedium,
        enumHot
    }

    /* loaded from: classes.dex */
    interface GeometryType {
        public static final int Bezier = 5123;
        public static final int EllipticArc = 5124;
        public static final int Envelope = 3077;
        public static final int Line = 5122;
        public static final int MultiPoint = 8710;
        public static final int Point = 513;
        public static final int Polygon = 27656;
        public static final int Polyline = 25607;
        public static final int Unknown = 0;
    }

    public static int getDimensionFromType(int i) {
        return (((i & 3072) >> 10) + 1) >> 1;
    }

    public static boolean isArea(int i) {
        return (i & 2048) != 0;
    }

    public static boolean isLinear(int i) {
        return (i & 1024) != 0;
    }

    public static boolean isMultiPath(int i) {
        return (i & 16384) != 0;
    }

    public static boolean isMultiVertex(int i) {
        return (i & 8192) != 0;
    }

    public static boolean isPoint(int i) {
        return (i & 512) != 0;
    }

    public static boolean isSegment(int i) {
        return (i & 4096) != 0;
    }

    public abstract void applyTransformation(Transformation2D transformation2D);

    abstract void applyTransformation(Transformation3D transformation3D);

    abstract void b(int i);

    abstract void c(int i);

    public double calculateArea2D() {
        return Utils.DOUBLE_EPSILON;
    }

    public double calculateLength2D() {
        return Utils.DOUBLE_EPSILON;
    }

    public abstract void copyTo(Geometry geometry);

    abstract Geometry createInstance();

    public abstract int getDimension();

    public abstract Type getType();

    public abstract boolean isEmpty();

    public abstract boolean isValid();

    public abstract void queryEnvelope(Envelope envelope);

    /* JADX INFO: Access modifiers changed from: package-private */
    public abstract void queryEnvelope2D(Envelope2D envelope2D);

    abstract void queryEnvelope3D(Envelope3D envelope3D);

    abstract Envelope1D queryInterval(int i, int i2);

    public abstract void setEmpty();

    /* loaded from: classes.dex */
    public enum Type {
        UNKNOWN(0),
        POINT(513),
        LINE(GeometryType.Line),
        ENVELOPE(GeometryType.Envelope),
        MULTIPOINT(GeometryType.MultiPoint),
        POLYLINE(GeometryType.Polyline),
        POLYGON(GeometryType.Polygon);
        
        private int a;

        public int value() {
            return this.a;
        }

        Type(int i) {
            this.a = i;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public VertexDescription getDescription() {
        return this.m_description;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void a(VertexDescription vertexDescription) {
        i();
        if (vertexDescription == this.m_description) {
            return;
        }
        for (int i = 0; i < 10; i++) {
            if (this.m_description.hasAttribute(i) && !vertexDescription.hasAttribute(i)) {
                b(i);
            }
        }
        VertexDescription vertexDescription2 = this.m_description;
        this.m_description = vertexDescription;
        for (int i2 = 0; i2 < 10; i2++) {
            if (!vertexDescription2.hasAttribute(i2) && vertexDescription.hasAttribute(i2)) {
                c(i2);
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void mergeVertexDescription(VertexDescription vertexDescription) {
        i();
        if (vertexDescription == this.m_description) {
            return;
        }
        VertexDescriptionDesignerImpl vertexDescriptionDesignerImpl = null;
        boolean z = false;
        for (int i = 0; i < 10; i++) {
            if (!this.m_description.hasAttribute(i) && vertexDescription.hasAttribute(i)) {
                if (!z) {
                    vertexDescriptionDesignerImpl = new VertexDescriptionDesignerImpl(this.m_description);
                    z = true;
                }
                vertexDescriptionDesignerImpl.addAttribute(i);
            }
        }
        if (z) {
            VertexDescription vertexDescription2 = this.m_description;
            this.m_description = vertexDescriptionDesignerImpl.getDescription();
            for (int i2 = 0; i2 < 10; i2++) {
                if (!vertexDescription2.hasAttribute(i2) && this.m_description.hasAttribute(i2)) {
                    c(i2);
                }
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public boolean e(int i) {
        return getDescription().hasAttribute(i);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void addAttribute(int i) {
        i();
        if (this.m_description.hasAttribute(i)) {
            return;
        }
        VertexDescriptionDesignerImpl vertexDescriptionDesignerImpl = new VertexDescriptionDesignerImpl(this.m_description);
        vertexDescriptionDesignerImpl.addAttribute(i);
        this.m_description = vertexDescriptionDesignerImpl.getDescription();
        c(i);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void dropAttribute(int i) {
        i();
        if (this.m_description.hasAttribute(i)) {
            VertexDescriptionDesignerImpl vertexDescriptionDesignerImpl = new VertexDescriptionDesignerImpl(this.m_description);
            vertexDescriptionDesignerImpl.c(i);
            b(i);
            this.m_description = vertexDescriptionDesignerImpl.getDescription();
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void dropAllAttributes() {
        a(VertexDescriptionDesignerImpl.d());
    }

    void queryLooseEnvelope2D(Envelope2D envelope2D) {
        queryEnvelope2D(envelope2D);
    }

    void queryLooseEnvelope3D(Envelope3D envelope3D) {
        queryEnvelope3D(envelope3D);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    public Object _getImpl() {
        throw new RuntimeException("invalid call");
    }

    void c() {
        addAttribute(1);
    }

    boolean d() {
        return e(1);
    }

    void e() {
        addAttribute(2);
    }

    boolean f() {
        return e(2);
    }

    void g() {
        addAttribute(3);
    }

    boolean h() {
        return e(3);
    }

    public Geometry copy() {
        Geometry createInstance = createInstance();
        copyTo(createInstance);
        return createInstance;
    }

    static Geometry a(Geometry geometry) {
        Geometry createInstance = geometry.createInstance();
        geometry.copyTo(createInstance);
        return createInstance;
    }

    public int getStateFlag() {
        this.m_touchFlag &= Integer.MAX_VALUE;
        return this.m_touchFlag;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public synchronized void i() {
        if (this.m_touchFlag >= 0) {
            this.m_touchFlag -= Integer.MAX_VALUE;
        }
    }

    Object writeReplace() throws ObjectStreamException {
        GeometrySerializer geometrySerializer = new GeometrySerializer();
        geometrySerializer.setGeometryByValue(this);
        return geometrySerializer;
    }
}
